<?php
class User_Model_RightMap 
{
 
	private $_table;
	//Initalizing Db Table  
	public function __construct(){
		$this->_table = new User_Model_DbTable_RightMap();
	}
	
	public function add($row){
		return $this->_table->insert($row);
	}
	
	public function getRightByUserid($user_id){
		$table = $this->_table->info('name');
		$select = $this->_table->select()->from($table, '*');
		$select->where('user_id = ?',$user_id);
		return $this->_table->fetchAll($select)->toArray();
	}
	
	public function deleteBy($user_id,$ur_id){		
		$where = $this->_table->getAdapter()->quoteInto('ur_id = ?', $ur_id);
		$where .= $this->_table->getAdapter()->quoteInto(' and user_id = ?', $user_id);
		$rows_affected = $this->_table->delete($where);
		return $rows_affected;
	}
	
}